/*
 * @lc app=leetcode.cn id=242 lang=cpp
 *
 * [242] 有效的字母异位词
 */

// @lc code=start
class Solution
{
public:
  bool isAnagram(string s, string t)
  {
    int m = s.size(), n = t.size();
    if (m != n) return false;
    int sc[26] = {
        0,
    },
        tc[26] = {
            0,
        };
    for (int i = 0; i < n; ++i) {
      sc[s[i] - 97]++;
      tc[t[i] - 97]++;
    }
    for (int i = 0; i < 26; ++i)
      if (sc[i] != tc[i])
        return false;
    return true;
  }
};
// @lc code=end
